<?php

namespace app\model;

use yzh52521\JwtAuth\user\AuthorizationUserInterface;

/**
 * admin 用户表
 * @property integer $id (主键)
 * @property string $username
 * @property string $password
 * @property string $name
 * @property string $avatar
 * @property integer $status
 * @property mixed $created_at
 * @property mixed $updated_at
 * @property string $salt
 * @property string $ip
 * @property string $token
 * @property string $remark
 * @property string $phone
 */
class SysAdmin extends BaseModel implements AuthorizationUserInterface
{
    /**
     * The connection name for the model.
     *
     * @var string|null
     */
    protected $connection = 'mysql';

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 't_sys_admin';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $pk = 'id';


    public function getUserById($id)
    {
        return $this->field([
            'id',
            'username',
            'nickname',
            'status',
        ])->find($id);


    }
}
